<template>
	<div class="call">
		<div class="contact" v-for="item in contactList" @click="call(item.phoneNumber)">
			<div class="name">{{ item.contactName }}</div>
			<div>{{ item.phoneNumber }}</div>
			<div class="iconfont icon-dadianhua"></div>
		</div>
	</div>
</template>

<script>
import { getContact } from '../api/contact/contact';
export default {
	data() {
		return {
			contactList: []
		};
	},
	created() {
		this.getContact();
	},
	methods: {
		async getContact() {
			const { rows } = await getContact();
			this.contactList = rows;
		},
		call(phoneNumber){
			uni.makePhoneCall({
				phoneNumber,
				success:()=>{
					console.log("成功")
				},
				fail:()=>{
					console.log("失败")
				}
			});
		}
	}
};
</script>

<style lang="less" scoped>
.call {
	.contact {
		display: flex;
		line-height: 100rpx;
		font-size: 30rpx;
		justify-content: space-between;
		.iconfont {
			font-size: 40rpx;
		}
		.name {
			width: 140rpx;
		}
	}
}
</style>
